package com.student.system.wapper;

import com.student.system.entity.Studentmessage;

import javax.servlet.http.HttpServletRequest;

public class StudentMessageWrapper {
    public static Studentmessage wrapper(HttpServletRequest req){
        Studentmessage studentmessage = new Studentmessage();
        try{
            studentmessage.setId(Integer.valueOf(req.getParameter("id")));
        }catch (Exception e){}

        studentmessage.setName(req.getParameter("name"));
        studentmessage.setStudentId(req.getParameter("studentId"));
        studentmessage.setPhone(req.getParameter("phone"));
        studentmessage.setIdentity(req.getParameter("identity"));

        studentmessage.setSex(req.getParameter("sex"));
        try{
            studentmessage.setAge(Integer.valueOf(req.getParameter("age")));
        }catch (Exception e){}

        studentmessage.setEmail(req.getParameter("email"));
        studentmessage.setMajor(req.getParameter("major"));
        studentmessage.setIdentityId(req.getParameter("identityId"));
        return studentmessage;
    }
}
